package book_management.book;

import java.util.ArrayList;
import java.util.List;

public class BookList {
    private List<Book> books = new ArrayList<>();
    //
    private List<String>booksName = new ArrayList<>();

    public BookList() {
        books.add(new Book("三国演义","罗贯中",66.6,"小说"));
        books.add(new Book("水浒传","施耐庵",25.6,"小说"));
        books.add(new Book("西游记","吴承恩",258.6,"小说"));
        books.add(new Book("红楼梦","曹雪芹&未知",87.6,"小说"));
    }

    public static void listbooks() {
    }


    public void listBooks(){
       for (Book book:books){
           System.out.println(book);
       }
    }
    public boolean contains(String booksName){
        for (String str:this.booksName){
            if (str.equals(booksName)){
                return true;
            }
        }
        return false;
    }

    public void addNewBook(String booksName, String author, String type, double price) {
        Book book=new Book(booksName,type,price,type);
        this.books.add(book);
        this.booksName.add(booksName);
    }
}
